let currentPage = 1;
const totalPages = 2;

function switchPage(pageNum) {
    if (pageNum === currentPage) return;
    
    // 隐藏所有页面
    document.querySelectorAll('.page-content').forEach(page => {
        page.style.display = 'none';
    });
    
    // 显示选中的页面
    document.getElementById(`page${pageNum}`).style.display = 'block';
    
    // 更新分页器状态
    updatePagination(pageNum);
}

function changePage(direction) {
    let newPage = currentPage;
    if (direction === 'prev' && currentPage > 1) {
        newPage--;
    } else if (direction === 'next' && currentPage < totalPages) {
        newPage++;
    }
    switchPage(newPage);
}

function updatePagination(pageNum) {
    // 更新当前页码
    currentPage = pageNum;
    
    // 更新页码显示
    document.getElementById('pageInfo').textContent = `${currentPage}/${totalPages}`;
    
    // 更新页码按钮样式
    document.querySelectorAll('.point-box').forEach(box => {
        if (box.textContent === currentPage.toString()) {
            box.classList.add('active');
        } else {
            box.classList.remove('active');
        }
    });
    
    // 禁用/启用前后页按钮
    const prevBtn = document.querySelector('.point-box');
    const nextBtn = document.querySelector('.point-box:last-child');
    
    prevBtn.style.opacity = currentPage === 1 ? '0.5' : '1';
    nextBtn.style.opacity = currentPage === totalPages ? '0.5' : '1';
}

// 初始化页面
document.addEventListener('DOMContentLoaded', function() {
    updatePagination(1);
});